var windowName = "servicesInfo";
var Page
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        //页面数据
        picTop:picBanner
        , loading: true
        ,from:"user"
        ,id:0
        ,product:{
            "id": 1,
            "user": {
                "id": 1,
                "name": "用户_15265461237",
                "phone": "15265461237",
                "avatar": "/ApiCloud/assets/img/userHead.jpeg",
                "addresses": [
                    "/api_/user_addresses/1",
                    "/api_/user_addresses/2",
                    "/api_/user_addresses/3",
                    "/api_/user_addresses/4",
                    "/api_/user_addresses/5",
                    "/api_/user_addresses/6",
                    "/api_/user_addresses/7"
                ],
                "contacts": [
                    "/api_/user_contacts/1",
                    "/api_/user_contacts/2",
                    "/api_/user_contacts/3",
                    "/api_/user_contacts/4"
                ],
                "shop": {
                    "id": 3,
                    "name": "用户_15265461237的店铺",
                    "logo": "/qz/4226tbrGZt3XNehQaSAzkep2jAZfsZG8p3ekCzCWEnYdMFwkCwZtYKbmrX8a8Afa.jpg",
                    "head": "/qz/pfZyWzfDM4t7siKdtEGh5zpSz65ARsiRttamJ4c7an6hABKiEDcBfFzwrnhijwSd.jpg",
                    "openStart": 0,
                    "openEnd": 0,
                    "city": "东营市",
                    "intro": "欢迎光临我的店铺！",
                    "lat": 37.411411,
                    "lon": 118.657893,
                    "phone": "15265461237",
                    "openStr": "全天营业",
                    "statistic": {
                        "orders": 3,
                        "products": 0,
                        "incomes": 0
                    }
                }
            },
            "shop": {
                "id": 3,
                "name": "用户_15265461237的店铺",
                "logo": "/qz/4226tbrGZt3XNehQaSAzkep2jAZfsZG8p3ekCzCWEnYdMFwkCwZtYKbmrX8a8Afa.jpg",
                "head": "/qz/pfZyWzfDM4t7siKdtEGh5zpSz65ARsiRttamJ4c7an6hABKiEDcBfFzwrnhijwSd.jpg",
                "openStart": 0,
                "openEnd": 0,
                "city": "东营市",
                "intro": "欢迎光临我的店铺！",
                "lat": 37.411411,
                "lon": 118.657893,
                "phone": "15265461237",
                "openStr": "全天营业",
                "statistic": {
                    "orders": 3,
                    "products": 0,
                    "incomes": 0
                }
            },
            "cat1": "/api_/categories/1",
            "cat2": "/api_/categories/10",
            "name": "服务超级标题",
            "cover": "/qz/Gsyy6d42QaK3rAhmhn2x43WQtSH8dJEjEYjtYGTSHYJMbSfr35AQT8rTDC2BYD8t.jpg",
            "subTitle": "",
            "price": 10,
            "unit": "次",
            "intro": "你看看经理吕璐模棱两可",
            "pics": [
                "/qz/Gsyy6d42QaK3rAhmhn2x43WQtSH8dJEjEYjtYGTSHYJMbSfr35AQT8rTDC2BYD8t.jpg",
                "/qz/s4J2DtierZs5pkj2xDy7dtmDefT7ECzEWrhSndB5Ji4mi2cJY7zX3XWMKdwsnYk6.jpg"
            ],
            "statistic": {"view":0,"score":0,"heart":0}
        }
        ,comments:[]
    },{
        //页面方法
        "init":function () {
            var data = getData4Page()
            var from = data.from
            this.from = from;
            var num = getLocData("contactPhone")
            this.num = num
            this.location = location.href

            var id = data.id
            this.id = data.id
            getData()
            var product = getLocData("servicesInfo");
            if (isTrue(product)){
                this.product = product;
            }
        }
        ,baiduditu:baiduditu
    })
    Page.init()
}
function getData(){
    apiGet("/api/products/" + Page.id,{},function (res) {
        logJson(res,"get_info_:_");
        clearLoading();
        setLocData("servicesInfo", res.data)
        Page.product = res.data
    })
    apiGet("/app/get/comments",{what:Page.id},function (res,code) {
        logJson(res,"/app/get/comments")
        Page.comments = res.data
    })
}